package com.egao.api.controller.nont;


import com.egao.common.core.annotation.OperLog;
import com.egao.common.core.damon.constant.UserConstant;
import com.egao.common.core.web.BaseController;
import com.egao.common.core.web.JsonResult;
import com.egao.common.system.entity.User;
import com.egao.common.system.service.OperRecordService;
import com.egao.orderB.entity.Address;
import com.egao.orderB.entity.MaintainFee;
import com.egao.orderB.service.AddressService;
import com.egao.orderB.service.MaintainFeeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

//import com.egao.orderB.entity.Bill;
//import com.egao.orderB.service.BillService;

/**
 * api登录相关接口
 * Created by wangfan on 2019-05-29 下午 3:43.
 * http://localhost/swagger-ui.html
 */
@RequestMapping("/api/nt/address")
@RestController
@Api(value = "运费维护管理",tags = {"运费维护管理"})
public class ApiAddressNtController extends BaseController {

    @Autowired
    private OperRecordService operRecordService;
    @Autowired
    private AddressService addressService;
    @Autowired
    private MaintainFeeService maintainFeeService;

    @PostMapping("/list")
    @ApiOperation(value = "运费报价列表",notes = "" +
            "province:省\n" +
            "city:市\n" +
            "district:县区\n" +
            "town:镇\n" +
            "boxType:箱型\n" +
            "address:详细地址\n" +
            "dock:码头\n" +
            " \n" +
            "返回的内容\n" +
            "id:id\n" +
            "organizationId:组织id\n" +
            "province:省\n" +
            "city:市\n" +
            "district:县区\n" +
            "town:镇\n" +
            "miles:公里数\n" +
            "boxType:箱型\n" +
            "price:价格\n" +
            "driverPrice:司机价格\n" +
            "commission:佣金\n" +
            "address:详细地址\n" +
            "remark:备注\n" +
            "createTime:创建时间\n" +
            "createUser:创建人\n" +
            "updateTime:更新时间\n" +
            "updateUser:更新人\n" +
            "deleted:del(0正常 1删除)\n" +
            "",httpMethod = "POST")
    public JsonResult list(MaintainFee maintainFee, HttpServletRequest request) {
        return JsonResult.ok().setData(maintainFeeService.list(maintainFee, new User(UserConstant.ADMIN_ID)));
    }

    @OperLog(value = "地址报价", desc = "")
    @PostMapping("/dockList")
    @ApiOperation(value = "码头列表",notes = "dock:码头",httpMethod = "POST")
    public JsonResult dockList(Address address, HttpServletRequest request) {
        return JsonResult.ok().setData(addressService.dockList(address, new User(UserConstant.ADMIN_ID)));
    }


}
